#ifndef _QCHARWIDGET_H
#define _QCHARWIDGET_H


#include <QtCore/QHash>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtGui/QWidget>


class QComboBox;
class QTableWidget;
class QTableWidgetItem;


namespace QAnsiEditor {


class QCharWidget : public QWidget
{
    Q_OBJECT

public:
    QCharWidget(QWidget *parent=0);
    virtual QSize sizeHint() const;

protected:
    void showEvent(QShowEvent *event);

private:
    enum {
        fixedRowCount = 10,
        fixedColumnCount = 16,
        fixedCellSize = 17
    };
    bool init();
    bool initCharData();
    bool initSecCombo();
    bool initCharTable(const QString &strKey);
    QComboBox *m_pSecCombo;
    QTableWidget *m_pCharTable;
    int m_iPreferredWidth;
    int m_iPreferredHeight;
    QHash<QString, QStringList> m_charHash;

signals:
    void charClicked(QTableWidgetItem *item);

private slots:
    void secChanged(const QString &text);

};


}  // namespace QAnsiEditor


#endif  // _QCHARWIDGET_H
